<?php

use Controller\Mobile;
use think\Db;

/**
 * 首页
 * Class IndexController
 */
class IndexController extends Mobile
{

    protected $needLoginActions = ['shoppingunit','checkstorestatus'];

    public function init()
    {
        parent::init();
        Yaf\Dispatcher::getInstance()->disableView();
    }


    /**
     * 首页
     */
    public function indexAction()
    {


//        $excel_data = [
//            ['编号', '姓名', '年龄'],
//            ['1', 'zhangsan', '25'],
//            ['2', 'lisi', '28'],
//        ];
//        #实例化对象
//        $XlswriterExcel = new \echoyii\XlswriterExcel();
//
//        #设置文件名
//        $XlswriterExcel->setBase('用户来源_'.date('YmdHis', time()));
//
//        #创建工作表
//        $XlswriterExcel->createSheet($excel_data, '用户来源');
//
//        #输出文件
//        $XlswriterExcel->fileOutput();


        think\Db::setConfig([
            'type'            => 'mysql',
            'hostname'        => 'test.mutouyun.com',
            'database'        => 'newmtytrade_0424',
            'username'        => 'root',
            'password'        => 'root',
            'hostport'        => '3307',
            'prefix'          => 't_',
            'debug'           => true,
        ]);

        $basicUserInfo = think\Db::name('user')->where("id=31579")->find();

    var_dump($basicUserInfo);die;


        $this->title = '首页';

        $mStoreModel = new StoreModel();
        $dataOne = [
            'store_total'   => $mStoreModel->countStores(),                                 //推荐商家列表
        ];
        $this->view(['dataOne' => $dataOne]);
    }

}